<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">

	<xsl:output method="xml" indent="yes" />

	<xsl:template match="/">
		<FriendReport>
			<Summary>
				<xsl:variable name="friend_count"
					select="count(Friends/Friend)" />
				<xsl:variable name="friends_count"
					select="count(Friends)" />
				Number of Friends elements =
				<xsl:value-of select="$friends_count" />
				Number of Friend elements =
				<xsl:value-of select="$friend_count" />
				<xsl:apply-templates select="Friends/Friend" />
			</Summary>
		</FriendReport>
	</xsl:template>

	<xsl:template match="Friend">
		<FriendRecord>
			<NickName>
				<xsl:value-of select="@nick_name" />
			</NickName>
			<Name>
				<xsl:value-of select="@name" />
			</Name>
			<Phone>
				<xsl:value-of select="@phone" />
			</Phone>
			<Notes>
				<xsl:value-of select="text()" />
			</Notes>
		</FriendRecord>
	</xsl:template>

</xsl:stylesheet>
